//2009/08/10 19:00:21
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <math.h>
#include <algorithm>

using namespace std;

class RaceApproximator
{
public:
    string timeToBeat(int d1, int t1, int d2, int t2, int d)
    {
		int second =(int) (t1 * exp(log(t2*1.0/t1)*log(d1*1.0/d)/log(d1*1.0/d2)));
		int hours = second / 3600;
		int mins = (second - hours * 3600) / 60;
		second %= 60;
		char s[100];
		sprintf(s, "%d:%.2d:%.2d", hours, mins, second);
		return s;
    }
};
